package com.kkb.robotcustomerservice.util;

import lombok.Data;


import java.io.Serializable;

@Data
public class ResponseResult implements Serializable {

    private int status = 200;
    private String message;
    private Object data;

    public static ResponseResult error() {
        return error(400, "未知异常，请联系管理员");
    }

    public static ResponseResult error(String msg) {
        return error(400, msg);
    }

    public static ResponseResult error(int code, String msg) {
        ResponseResult r = new ResponseResult();
        r.setStatus(code);
        r.setMessage(msg);
        return r;
    }

    public static ResponseResult ok(String msg) {
        ResponseResult r = new ResponseResult();
        r.setMessage(msg);
        return r;
    }

    public static ResponseResult ok(Object data) {
        ResponseResult r = new ResponseResult();
        r.setData(data);
        return r;
    }

    public static ResponseResult ok(String msg,Object data) {
        ResponseResult r = new ResponseResult();
        r.setMessage(msg);
        r.setData(data);
        return r;
    }

    public static ResponseResult ok() {
        return new ResponseResult();
    }

}
